<template>
	<view>
		<view class="head">
			<text>SPECIAL</text>
			<text>专题精选</text>
		</view>
		<view class="obj-list">
			<view class="item" v-for="(item, index) in obj_list" :key="index" @click="itemCli(item)" :style="{background: 'url(' + item.cover + ')', 'background-position': 'center', 'background-size': '100%'}">
				<text class="name">{{item.name}}</text>
				<text class="info" v-html="item.plan_desc"></text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				obj_list: []
			};
		},
		mounted() {
			this.getData()
		},
		methods: {
			getData: function() {
				this.$api.cyclePurchase({
					plan_type: 1
				})
					.then(res => {
						console.log(res);
						this.obj_list = res.data
					})
					.catch(err => {
						if (err.msg)
							this.$db._ShowToast(err.msg)
					})
			},
			itemCli: function(item){
				this.$db._NavTo('cycle-buy-detail-page', {id: item.id})
			}
		}

	}
</script>

<style lang="scss">
	page {
		background: #fcfcfc;
	}

	.head {
		height: 120rpx;
		display: flex;
		flex-flow: column;
		justify-content: center;
		align-items: center;
		background: #fff;

		text {
			font-size: 26rpx;
		}

		&>text:nth-child(1) {
			margin-bottom: 10rpx;
			color: #DFBB50;
		}

		&>text:nth-child(2) {
			color: #9b9e8b;
		}

	}

	.obj-list {
		margin-top: 14rpx;
		display: flex;
		flex-flow: column;
		align-items: center;

		.item {
			margin-bottom: 24rpx;
			padding: 0 30rpx;
			height: 295rpx;
			width: 705rpx;
			display: flex;
			flex-flow: column;
			justify-content: center;
			align-items: flex-start;
			box-sizing: border-box;
			background: url(../../static/public/timg@2x.png);
			background-position: center;
			background-size: 100%;
			background-repeat: no-repeat;
			border-radius: 20rpx;

			.name {
				font-size: 26rpx;
				font-weight: bold;
				color: #fff;
				padding: 17rpx 0;
				border-bottom: 1px solid #fff;
			}

			.info {
				margin-top: 14rpx;
				padding: 5rpx 8rpx;
				width: 250rpx;
				border-radius: 8rpx;
				font-size: 24rpx;
				background: #fff;
			}
		}
	}
</style>
